//
//  CustomerInsideViewController.m
//  HondaPro_2
//
//  Created by ht on 13-7-21.
//  Copyright (c) 2013年 glendale. All rights reserved.
//

#import "CustomerInsideViewController.h"
#import <QuartzCore/QuartzCore.h>
#import "webConfig.h"
#import "webService.h"
#import "HelpClass.h"
#import "SVProgressHUD.h"
#import "InformationViewController.h"
@interface CustomerInsideViewController ()
{
    BOOL _yonghuchoose;
}

@end

@implementation CustomerInsideViewController
@synthesize noteTextView = _noteTextView;

@synthesize keHuBianHao = _keHuBianHao;
@synthesize editNewfield2 = _editNewfield2;
@synthesize editNewfield3 = _editNewfield3;
@synthesize editNewfield4 = _editNewfield4;
@synthesize editNewfield5 = _editNewfield5;
@synthesize editNewfield6 = _editNewfield6;
@synthesize editNewfield7 = _editNewfield7;
@synthesize editNewfield8 = _editNewfield8;
@synthesize editNewfield9 = _editNewfield9;

@synthesize editNewbutton1 = _editNewbutton1;
@synthesize editNewbutton2 = _editNewbutton2;
@synthesize editNewbutton3 = _editNewbutton3;
@synthesize editNewbutton4 = _editNewbutton4;
@synthesize editNewbutton5 = _editNewbutton5;
@synthesize editNewbutton6 = _editNewbutton6;
@synthesize editNewbutton7 = _editNewbutton7;
@synthesize editNewbutton8 = _editNewbutton8;
@synthesize editNewbutton9 = _editNewbutton9;
@synthesize editNewbutton10 = _editNewbutton10;

@synthesize baocunButton = _baocunButton;
@synthesize guanbiButton = _guanbiButton;
@synthesize containerView = _containerView;

@synthesize customerInsideDit = _customerInsideDit;
@synthesize currentDit = _currentDit;

- (id)init
{
    self = [super init];
    if (self)
    {
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    //通用代码表的字典
    self.dicTmp = [HelpClass returnTheDataByJsonFileAndJustForTestWithFileName:@"codeA" andType:@"json"];
    [SVProgressHUD dismiss];
    self.containerView = [[UIView alloc]initWithFrame:CGRectMake(70, 100, 1024-70-70, 668)];
    [self.view setBackgroundColor:[UIColor whiteColor]];
    [self.containerView setBackgroundColor:[UIColor clearColor]];
    [self.view addSubview:self.containerView];
    
    [self content];
    [self AVarietyOfTextField];
    [self AVarietyOfButton];
    
    //注册键盘即将消失的消息
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(keyboardHide:)
                                                 name:UIKeyboardDidHideNotification
                                               object:nil];
}
-(void)viewWillAppear:(BOOL)animated
{
    [self addNotification];
}
#pragma mark - 各种输入框
-(void)AVarietyOfTextField
{
    self.keHuBianHao = [[UILabel alloc]initWithFrame:CGRectMake(95, 65, 165, 30)];    //客户编号
    self.keHuBianHao.textColor = [UIColor grayColor];
    self.keHuBianHao.layer.borderColor = [[UIColor grayColor]CGColor];
    self.keHuBianHao.layer.borderWidth = 0.9;
    self.keHuBianHao.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.keHuBianHao.text = [self.customerInsideDit objectForKey:@"customerId"];
    [self.keHuBianHao setTextAlignment:NSTextAlignmentCenter];
    [self.containerView addSubview:self.keHuBianHao];
    
    self.editNewfield2 = [[UITextField alloc]initWithFrame:CGRectMake(95, 110, 165, 30)];    //客户名称
    self.editNewfield2.borderStyle = UITextBorderStyleLine;
    self.editNewfield2.textColor = [UIColor grayColor];
    self.editNewfield2.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.editNewfield2.text = [self.customerInsideDit objectForKey:@"customerName"];
    [self.editNewfield2 setTextAlignment:NSTextAlignmentCenter];
    self.editNewfield2.contentVerticalAlignment = UIControlContentHorizontalAlignmentCenter;
    [self.containerView addSubview:self.editNewfield2];
    
    self.editNewfield3 = [[UITextField alloc]initWithFrame:CGRectMake(95, 155, 165, 30)];    //手机号
    self.editNewfield3.borderStyle = UITextBorderStyleLine;
    self.editNewfield3.keyboardType = UIKeyboardTypeNumberPad;
    self.editNewfield3.textColor = [UIColor grayColor];
    self.editNewfield3.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.editNewfield3.text = [self.customerInsideDit objectForKey:@"mobile"];
    [self.editNewfield3 setTextAlignment:NSTextAlignmentCenter];
    self.editNewfield3.contentVerticalAlignment = UIControlContentHorizontalAlignmentCenter;
    [self.containerView addSubview:self.editNewfield3];
    
    self.editNewfield4 = [[UITextField alloc]initWithFrame:CGRectMake(95, 288, 165, 30)];    //联系人
    self.editNewfield4.borderStyle = UITextBorderStyleLine;
    self.editNewfield4.textColor = [UIColor grayColor];
    self.editNewfield4.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.editNewfield4.text = [self.customerInsideDit objectForKey:@"contactMan"];
    [self.editNewfield4 setTextAlignment:NSTextAlignmentCenter];
    self.editNewfield4.contentVerticalAlignment = UIControlContentHorizontalAlignmentCenter;
    self.editNewfield4.delegate = self;
    [self.containerView addSubview:self.editNewfield4];
    
    self.editNewfield5 = [[UITextField alloc]initWithFrame:CGRectMake(95, 333, 165, 30)];    //联系电话
    self.editNewfield5.borderStyle = UITextBorderStyleLine;
    self.editNewfield5.keyboardType = UIKeyboardTypeNumberPad;
    self.editNewfield5.textColor = [UIColor grayColor];
    self.editNewfield5.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.editNewfield5.text = [self.customerInsideDit objectForKey:@"tel"];
    [self.editNewfield5 setTextAlignment:NSTextAlignmentCenter];
    self.editNewfield5.contentVerticalAlignment = UIControlContentHorizontalAlignmentCenter;
    self.editNewfield5.delegate = self;
    [self.containerView addSubview:self.editNewfield5];
    
    self.editNewfield6 = [[UITextField alloc]initWithFrame:CGRectMake(380, 65, 400, 30)];    //联系地址
    self.editNewfield6.borderStyle = UITextBorderStyleLine;
    self.editNewfield6.textColor = [UIColor grayColor];
    self.editNewfield6.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.editNewfield6.text = [self.customerInsideDit objectForKey:@"address"];
    [self.editNewfield6 setTextAlignment:NSTextAlignmentCenter];
    self.editNewfield6.contentVerticalAlignment = UIControlContentHorizontalAlignmentCenter;
    [self.containerView addSubview:self.editNewfield6];
    
    self.editNewfield7 = [[UITextField alloc]initWithFrame:CGRectMake(380, 110, 165, 30)];    //邮编
    self.editNewfield7.borderStyle = UITextBorderStyleLine;
    self.editNewfield7.keyboardType = UIKeyboardTypeNumberPad;
    self.editNewfield7.textColor = [UIColor grayColor];
    self.editNewfield7.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.editNewfield7.text = [self.customerInsideDit objectForKey:@"zipcode"];
    [self.editNewfield7 setTextAlignment:NSTextAlignmentCenter];
    self.editNewfield7.contentVerticalAlignment = UIControlContentHorizontalAlignmentCenter;
    [self.containerView addSubview:self.editNewfield7];
    
    self.editNewfield8 = [[UITextField alloc]initWithFrame:CGRectMake(380, 155, 165, 30)];    //传真
    self.editNewfield8.borderStyle = UITextBorderStyleLine;
    self.editNewfield8.keyboardType = UIKeyboardTypeNumberPad;
    self.editNewfield8.textColor = [UIColor grayColor];
    self.editNewfield8.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.editNewfield8.text = [self.customerInsideDit objectForKey:@"fax"];
    [self.editNewfield8 setTextAlignment:NSTextAlignmentCenter];
    self.editNewfield8.contentVerticalAlignment = UIControlContentHorizontalAlignmentCenter;
    [self.containerView addSubview:self.editNewfield8];
    
    self.editNewfield9 = [[UITextField alloc]initWithFrame:CGRectMake(380, 333, 220, 30)];    //证件号码
    self.editNewfield9.borderStyle = UITextBorderStyleLine;
    self.editNewfield9.keyboardType = UIKeyboardTypeNumberPad;
    self.editNewfield9.textColor = [UIColor grayColor];
    self.editNewfield9.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.editNewfield9.text = [self.customerInsideDit objectForKey:@"certificate"];
    [self.editNewfield9 setTextAlignment:NSTextAlignmentCenter];
    self.editNewfield9.contentVerticalAlignment = UIControlContentHorizontalAlignmentCenter;
    self.editNewfield9.delegate = self;
    [self.containerView addSubview:self.editNewfield9];
    
    self.noteTextView = [[UITextView alloc]initWithFrame:CGRectMake(95, 427, 505, 120)];    //备注
    [self.noteTextView setFont:[UIFont fontWithName:@"ArialMT" size:14]];
    self.noteTextView.textColor = [UIColor grayColor];
    self.noteTextView.layer.borderColor = [[UIColor grayColor]CGColor];
    self.noteTextView.layer.borderWidth = 0.9;
    self.noteTextView.text = [self.customerInsideDit objectForKey:@"remark"];
    self.noteTextView.delegate = self;
    [self.containerView addSubview:self.noteTextView];
}
#pragma mark - 各种选择按钮
-(void)AVarietyOfButton
{
    UILabel *label1 = [[UILabel alloc]initWithFrame:CGRectMake(95, 200, 165, 30)];
    [label1 setBackgroundColor:[UIColor clearColor]];
    label1.layer.borderColor = [[UIColor grayColor]CGColor];
    label1.layer.borderWidth = 0.9;
    [self.containerView addSubview:label1];
    self.editNewbutton1 = [UIButton buttonWithType:UIButtonTypeCustom];         //客户来源
    [self.editNewbutton1 setFrame:CGRectMake(96, 201, 163, 28)];
    [self.editNewbutton1 setBackgroundImage:[UIImage imageNamed:@"下拉框.png"] forState:UIControlStateNormal];
   
    [self.editNewbutton1 addTarget:self action:@selector(editNewbutton1:) forControlEvents:UIControlEventTouchUpInside];

    if ([[self.customerInsideDit objectForKey:@"sourceName"] isEqual:@"A1"]) {
        
        [self.editNewbutton1 setTitle:@"自然来店" forState:UIControlStateNormal];
        
    }else if ([[self.customerInsideDit objectForKey:@"sourceName"] isEqual:@"A2"]){
        
        [self.editNewbutton1 setTitle:@"保有增购/换购" forState:UIControlStateNormal];
        
    }else if ([[self.customerInsideDit objectForKey:@"sourceName"] isEqual:@"A3"]){
        
        [self.editNewbutton1 setTitle:@"情报提供" forState:UIControlStateNormal];
        
    }else if ([[self.customerInsideDit objectForKey:@"sourceName"] isEqual:@"A4"]){
        
        [self.editNewbutton1 setTitle:@"店外开发" forState:UIControlStateNormal];
        
    }else if ([[self.customerInsideDit objectForKey:@"sourceName"] isEqual:@"A5"]){
        
        [self.editNewbutton1 setTitle:@"保有推介" forState:UIControlStateNormal];
    }else{
        [self.editNewbutton1 setTitle:[self.customerInsideDit objectForKey:@"sourceName"] forState:UIControlStateNormal];
    }
    //[self.editNewbutton1 setTitle:[self.customerInsideDit objectForKey:@"sourceName"] forState:UIControlStateNormal];
    self.editNewbutton1.titleLabel.font = [UIFont fontWithName:@"ArialMT" size:15];
    [self.editNewbutton1 setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [self.containerView addSubview:self.editNewbutton1];
    
    UILabel *label2 = [[UILabel alloc]initWithFrame:CGRectMake(95, 243, 165, 30)];
    [label2 setBackgroundColor:[UIColor clearColor]];
    label2.layer.borderColor = [[UIColor grayColor]CGColor];
    label2.layer.borderWidth = 0.9;
    [self.containerView addSubview:label2];
    self.editNewbutton2 = [UIButton buttonWithType:UIButtonTypeCustom];         //客户性质
    [self.editNewbutton2 setFrame:CGRectMake(96, 244, 163, 28)];
    [self.editNewbutton2 setBackgroundImage:[UIImage imageNamed:@"下拉框.png"] forState:UIControlStateNormal];
    [self.editNewbutton2 addTarget:self action:@selector(editNewbutton2:) forControlEvents:UIControlEventTouchUpInside];
    

    [self.editNewbutton2 setTitle:[self.customerInsideDit objectForKey:@"natureName"] forState:UIControlStateNormal];
    self.editNewbutton2.titleLabel.font = [UIFont fontWithName:@"ArialMT" size:15];
    [self.editNewbutton2 setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [self.containerView addSubview:self.editNewbutton2];
    UILabel *label3 = [[UILabel alloc]initWithFrame:CGRectMake(380, 200, 165, 30)];
    [label3 setBackgroundColor:[UIColor clearColor]];
    label3.layer.borderColor = [[UIColor grayColor]CGColor];
    label3.layer.borderWidth = 0.9;
    [self.containerView addSubview:label3];
    self.editNewbutton3 = [UIButton buttonWithType:UIButtonTypeCustom];          //性别
    [self.editNewbutton3 setFrame:CGRectMake(381, 201, 163, 28)];
    [self.editNewbutton3 setBackgroundImage:[UIImage imageNamed:@"下拉框.png"] forState:UIControlStateNormal];
    [self.editNewbutton3 addTarget:self action:@selector(editNewbutton3:) forControlEvents:UIControlEventTouchUpInside];
    [self.editNewbutton3 setTitle:[self.customerInsideDit objectForKey:@"gender"] forState:UIControlStateNormal];
    self.editNewbutton3.titleLabel.font = [UIFont fontWithName:@"ArialMT" size:15];
    [self.editNewbutton3 setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [self.containerView addSubview:self.editNewbutton3];
    UILabel *label4 = [[UILabel alloc]initWithFrame:CGRectMake(380, 244, 165, 30)];
    [label4 setBackgroundColor:[UIColor clearColor]];
    label4.layer.borderColor = [[UIColor grayColor]CGColor];
    label4.layer.borderWidth = 0.9;
    [self.containerView addSubview:label4];
    self.editNewbutton4 = [UIButton buttonWithType:UIButtonTypeCustom];          //出生日期
    [self.editNewbutton4 setFrame:CGRectMake(381, 245, 163, 28)];
    [self.editNewbutton4 setBackgroundImage:[UIImage imageNamed:@"下拉框.png"] forState:UIControlStateNormal];
    [self.editNewbutton4 addTarget:self action:@selector(editNewbutton4:) forControlEvents:UIControlEventTouchUpInside];
    [self.editNewbutton4 setTitle:[self.customerInsideDit objectForKey:@"birthday"] forState:UIControlStateNormal];
    self.editNewbutton4.titleLabel.font = [UIFont fontWithName:@"ArialMT" size:15];
    [self.editNewbutton4 setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [self.containerView addSubview:self.editNewbutton4];
    
    UILabel *label5 = [[UILabel alloc]initWithFrame:CGRectMake(380, 288, 165, 30)];
    [label5 setBackgroundColor:[UIColor clearColor]];
    label5.layer.borderColor = [[UIColor grayColor]CGColor];
    label5.layer.borderWidth = 0.9;
    [self.containerView addSubview:label5];
    self.editNewbutton5 = [UIButton buttonWithType:UIButtonTypeCustom];           //证件类型
    [self.editNewbutton5 setFrame:CGRectMake(381, 289, 163, 28)];
    [self.editNewbutton5 setBackgroundImage:[UIImage imageNamed:@"下拉框.png"] forState:UIControlStateNormal];
    [self.editNewbutton5 addTarget:self action:@selector(editNewbutton5:) forControlEvents:UIControlEventTouchUpInside];
    [self.editNewbutton5 setTitle:[self.customerInsideDit objectForKey:@"certificateType"] forState:UIControlStateNormal];
    self.editNewbutton5.titleLabel.font = [UIFont fontWithName:@"ArialMT" size:15];
    [self.editNewbutton5 setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [self.containerView addSubview:self.editNewbutton5];
    
    UILabel *label6 = [[UILabel alloc]initWithFrame:CGRectMake(665, 110, 165, 30)];
    [label6 setBackgroundColor:[UIColor clearColor]];
    label6.layer.borderColor = [[UIColor grayColor]CGColor];
    label6.layer.borderWidth = 0.9;
    [self.containerView addSubview:label6];
    self.editNewbutton6 = [UIButton buttonWithType:UIButtonTypeCustom];            //职业
    [self.editNewbutton6 setFrame:CGRectMake(666, 111, 163, 28)];
    [self.editNewbutton6 setBackgroundImage:[UIImage imageNamed:@"下拉框.png"] forState:UIControlStateNormal];
    [self.editNewbutton6 addTarget:self action:@selector(editNewbutton6:) forControlEvents:UIControlEventTouchUpInside];
    [self.editNewbutton6 setTitle:[self.customerInsideDit objectForKey:@"job"] forState:UIControlStateNormal];
    self.editNewbutton6.titleLabel.font = [UIFont fontWithName:@"ArialMT" size:15];
    [self.editNewbutton6 setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [self.containerView addSubview:self.editNewbutton6];
    
    UILabel *label7 = [[UILabel alloc]initWithFrame:CGRectMake(665, 155, 165, 30)];
    [label7 setBackgroundColor:[UIColor clearColor]];
    label7.layer.borderColor = [[UIColor grayColor]CGColor];
    label7.layer.borderWidth = 0.9;
    [self.containerView addSubview:label7];
    self.editNewbutton7 = [UIButton buttonWithType:UIButtonTypeCustom];            //兴趣爱好
    [self.editNewbutton7 setFrame:CGRectMake(666, 156, 163, 28)];
    [self.editNewbutton7 setBackgroundImage:[UIImage imageNamed:@"下拉框.png"] forState:UIControlStateNormal];
    [self.editNewbutton7 addTarget:self action:@selector(editNewbutton7:) forControlEvents:UIControlEventTouchUpInside];
    [self.editNewbutton7 setTitle:[self.customerInsideDit objectForKey:@"hobbies"] forState:UIControlStateNormal];
    self.editNewbutton7.titleLabel.font = [UIFont fontWithName:@"ArialMT" size:15];
    [self.editNewbutton7 setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [self.containerView addSubview:self.editNewbutton7];
    
    UILabel *label8 = [[UILabel alloc]initWithFrame:CGRectMake(665, 199, 165, 30)];
    [label8 setBackgroundColor:[UIColor clearColor]];
    label8.layer.borderColor = [[UIColor grayColor]CGColor];
    label8.layer.borderWidth = 0.9;
    [self.containerView addSubview:label8];
    self.editNewbutton8 = [UIButton buttonWithType:UIButtonTypeCustom];            //婚姻状况
    [self.editNewbutton8 setFrame:CGRectMake(666, 200, 163, 28)];
    [self.editNewbutton8 setBackgroundImage:[UIImage imageNamed:@"下拉框.png"] forState:UIControlStateNormal];
    [self.editNewbutton8 addTarget:self action:@selector(editNewbutton8:) forControlEvents:UIControlEventTouchUpInside];
    [self.editNewbutton8 setTitle:[self.customerInsideDit objectForKey:@"marital"] forState:UIControlStateNormal];
    self.editNewbutton8.titleLabel.font = [UIFont fontWithName:@"ArialMT" size:15];
    [self.editNewbutton8 setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [self.containerView addSubview:self.editNewbutton8];
    
    UILabel *label9 = [[UILabel alloc]initWithFrame:CGRectMake(665, 241, 165, 30)];
    [label9 setBackgroundColor:[UIColor clearColor]];
    label9.layer.borderColor = [[UIColor grayColor]CGColor];
    label9.layer.borderWidth = 0.9;
    [self.containerView addSubview:label9];
    self.editNewbutton9 = [UIButton buttonWithType:UIButtonTypeCustom];            //生产厂家
    [self.editNewbutton9 setFrame:CGRectMake(666, 242, 163, 28)];
    [self.editNewbutton9 setBackgroundImage:[UIImage imageNamed:@"下拉框.png"] forState:UIControlStateNormal];
    [self.editNewbutton9 addTarget:self action:@selector(editNewbutton9:) forControlEvents:UIControlEventTouchUpInside];
    [self.editNewbutton9 setTitle:[self.customerInsideDit objectForKey:@"originalfactory"] forState:UIControlStateNormal];
    self.editNewbutton9.titleLabel.font = [UIFont fontWithName:@"ArialMT" size:15];
    [self.editNewbutton9 setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [self.containerView addSubview:self.editNewbutton9];
    
    UILabel *label10 = [[UILabel alloc]initWithFrame:CGRectMake(665, 285, 165, 30)];
    [label10 setBackgroundColor:[UIColor clearColor]];
    label10.layer.borderColor = [[UIColor grayColor]CGColor];
    label10.layer.borderWidth = 0.9;
    [self.containerView addSubview:label10];
    self.editNewbutton10 = [UIButton buttonWithType:UIButtonTypeCustom];            //车辆品牌
    [self.editNewbutton10 setFrame:CGRectMake(666, 286, 163, 28)];
    [self.editNewbutton10 setBackgroundImage:[UIImage imageNamed:@"下拉框.png"] forState:UIControlStateNormal];
    [self.editNewbutton10 addTarget:self action:@selector(editNewbutton10:) forControlEvents:UIControlEventTouchUpInside];
    [self.editNewbutton10 setTitle:[self.customerInsideDit objectForKey:@"originalcar"] forState:UIControlStateNormal];
    self.editNewbutton10.titleLabel.font = [UIFont fontWithName:@"ArialMT" size:15];
    [self.editNewbutton10 setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [self.containerView addSubview:self.editNewbutton10];
    
    //查找省
    NSMutableArray *container = [[NSMutableArray alloc]init];
    NSMutableArray *nameS = [[NSMutableArray alloc]init];
    NSMutableArray *provinceArray = [NSMutableArray arrayWithArray:[self.dicTmp objectForKey:@"area"]];
    for(int i = 0; i < [provinceArray count]; i++)
    {
        [container addObject:[[provinceArray objectAtIndex:i]objectForKey:@"key"]];
        [nameS addObject:[[provinceArray objectAtIndex:i] objectForKey:@"value"]];
    }
    NSString *str;
    if([HelpClass isPureInt:[self.customerInsideDit valueForKey:@"province"]])
    {
        str = [nameS objectAtIndex:[container indexOfObject:[self.customerInsideDit valueForKey:@"province"]]];
    }
    else
    {
        str = @"";
    }
    
        UILabel *label11 = [[UILabel alloc]initWithFrame:CGRectMake(95, 378, 150, 30)];
        [label11 setBackgroundColor:[UIColor clearColor]];
        label11.layer.borderColor = [[UIColor grayColor]CGColor];
        label11.layer.borderWidth = 0.9;
        [self.containerView addSubview:label11];
        self.diQuSheng = [UIButton buttonWithType:UIButtonTypeCustom];             //省
        [self.diQuSheng setFrame:CGRectMake(96, 379, 148, 28)];
        [self.diQuSheng setBackgroundImage:[UIImage imageNamed:@"下拉框.png"] forState:UIControlStateNormal];
        [self.diQuSheng addTarget:self action:@selector(diQuSheng:) forControlEvents:UIControlEventTouchUpInside];
        [self.diQuSheng setTitle:str forState:UIControlStateNormal];
        self.diQuSheng.titleLabel.font = [UIFont fontWithName:@"ArialMT" size:14];
        [self.diQuSheng setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
        [self.containerView addSubview:self.diQuSheng];
        
        //查找市
        NSMutableArray *container2 = [[NSMutableArray alloc]init];
        NSMutableArray *nameY = [[NSMutableArray alloc]init];
    NSMutableArray *cityArray;
         NSString *str2;
         if([HelpClass isPureInt:[self.customerInsideDit valueForKey:@"province"]])
         {
             cityArray = [NSMutableArray arrayWithArray:[[provinceArray objectAtIndex:[container indexOfObject:[self.customerInsideDit valueForKey:@"province"]]] objectForKey:@"subArea"]];
             for(int i = 0; i < [cityArray count]; i++)
             {
                 [container2 addObject:[[cityArray objectAtIndex:i]objectForKey:@"key"]];
                 [nameY addObject:[[cityArray objectAtIndex:i] objectForKey:@"value"]];
             }
            str2 = [nameY objectAtIndex:[container2 indexOfObject:[self.customerInsideDit valueForKey:@"city"]]];
         }
         else
         {
            str2 = @"";
         }
        UILabel *label12 = [[UILabel alloc]initWithFrame:CGRectMake(255, 378, 150, 30)];
        [label12 setBackgroundColor:[UIColor clearColor]];
        label12.layer.borderColor = [[UIColor grayColor]CGColor];
        label12.layer.borderWidth = 0.9;
        [self.containerView addSubview:label12];
        self.diQuShi = [UIButton buttonWithType:UIButtonTypeCustom];             //市
        [self.diQuShi setFrame:CGRectMake(256, 379, 148, 28)];
        [self.diQuShi setBackgroundImage:[UIImage imageNamed:@"下拉框.png"] forState:UIControlStateNormal];
        [self.diQuShi addTarget:self action:@selector(diQuShi:) forControlEvents:UIControlEventTouchUpInside];
        [self.diQuShi setTitle:str2 forState:UIControlStateNormal];
        self.diQuShi.titleLabel.font = [UIFont fontWithName:@"ArialMT" size:14];
        [self.diQuShi setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
        [self.containerView addSubview:self.diQuShi];
        
        //查找地区
        NSString *data = [self.customerInsideDit valueForKey:@"district"];
        NSString *stringtmp;
    if([HelpClass isPureInt:[self.customerInsideDit valueForKey:@"province"]])
    {
        stringtmp = [data substringFromIndex:data.length-2];
    }
    else
    {
        stringtmp = @"";
    }
    
        if([stringtmp isEqualToString:@"00"])
        {
            int intdata = [data intValue];
            int intdataTmp = intdata+1;
            NSString *strNew = [NSString stringWithFormat:@"%d",intdataTmp];
            
            NSMutableArray *container3 = [[NSMutableArray alloc]init];
            NSMutableArray *nameD = [[NSMutableArray alloc]init];
        
            NSMutableArray *countyArray = [NSMutableArray arrayWithArray:[[cityArray objectAtIndex:[container2 indexOfObject:[self.customerInsideDit valueForKey:@"city"]]] objectForKey:@"subArea"]];
            for(int i = 0; i < [countyArray count]; i++)
            {
                [container3 addObject:[[countyArray objectAtIndex:i]objectForKey:@"key"]];
                [nameD addObject:[[countyArray objectAtIndex:i] objectForKey:@"value"]];
            }
            
            NSString *str3 = [nameD objectAtIndex:[container3 indexOfObject:strNew]];
            
            UILabel *label13 = [[UILabel alloc]initWithFrame:CGRectMake(415, 378, 150, 30)];
            [label13 setBackgroundColor:[UIColor clearColor]];
            label13.layer.borderColor = [[UIColor grayColor]CGColor];
            label13.layer.borderWidth = 0.9;
            [self.containerView addSubview:label13];
            self.diQuDiqu = [UIButton buttonWithType:UIButtonTypeCustom];             //地区
            [self.diQuDiqu setFrame:CGRectMake(416, 379, 148, 28)];
            [self.diQuDiqu setBackgroundImage:[UIImage imageNamed:@"下拉框.png"] forState:UIControlStateNormal];
            [self.diQuDiqu addTarget:self action:@selector(diQuDiqu:) forControlEvents:UIControlEventTouchUpInside];
            [self.diQuDiqu setTitle:str3 forState:UIControlStateNormal];
            self.diQuDiqu.titleLabel.font = [UIFont fontWithName:@"ArialMT" size:14];
            [self.diQuDiqu setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
            [self.containerView addSubview:self.diQuDiqu];
        }
        else
        {
            NSMutableArray *container3 = [[NSMutableArray alloc]init];
            NSMutableArray *nameD = [[NSMutableArray alloc]init];
            NSMutableArray *countyArray = [NSMutableArray arrayWithArray:[[cityArray objectAtIndex:[container2 indexOfObject:[self.customerInsideDit valueForKey:@"city"]]] objectForKey:@"subArea"]];
            for(int i = 0; i < [countyArray count]; i++)
            {
                [container3 addObject:[[countyArray objectAtIndex:i]objectForKey:@"key"]];
                [nameD addObject:[[countyArray objectAtIndex:i] objectForKey:@"value"]];
            }
            NSString *str3;
            if([HelpClass isPureInt:[self.customerInsideDit valueForKey:@"city"]])
            {
                str3 = [nameD objectAtIndex:[container3 indexOfObject:[self.customerInsideDit valueForKey:@"district"]]];
            }
            else
            {
                str3 = @"";
            }
            UILabel *label13 = [[UILabel alloc]initWithFrame:CGRectMake(415, 378, 150, 30)];
            [label13 setBackgroundColor:[UIColor clearColor]];
            label13.layer.borderColor = [[UIColor grayColor]CGColor];
            label13.layer.borderWidth = 0.9;
            [self.containerView addSubview:label13];
            self.diQuDiqu = [UIButton buttonWithType:UIButtonTypeCustom];             //地区
            [self.diQuDiqu setFrame:CGRectMake(416, 379, 148, 28)];
            [self.diQuDiqu setBackgroundImage:[UIImage imageNamed:@"下拉框.png"] forState:UIControlStateNormal];
            [self.diQuDiqu addTarget:self action:@selector(diQuDiqu:) forControlEvents:UIControlEventTouchUpInside];
            [self.diQuDiqu setTitle:str3 forState:UIControlStateNormal];
            self.diQuDiqu.titleLabel.font = [UIFont fontWithName:@"ArialMT" size:14];
            [self.diQuDiqu setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
            [self.containerView addSubview:self.diQuDiqu];
        }
    ///////////////////////////////////////////////////////
    
    
    //测试label
    _ceshi = [[UILabel alloc]initWithFrame:CGRectMake(750, 350, 150, 30)];
    //_ceshi.text=@"0";

    _ceshi.hidden=YES;
    _ceshi.textColor = [UIColor grayColor];
    [self.containerView addSubview:_ceshi];

    //是否协议客户
    self.yonghu = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.yonghu setFrame:CGRectMake(650, 331, 35, 36)];
    //NSString *str1=@"0";
    //NSString *string2=@"0";
    NSString *string2 = [self.customerInsideDit valueForKey:@"ispayclient"];

    if([string2 isEqualToString:@"0"])
    {
        _yonghuchoose = YES;
        [self.yonghu setImage:[UIImage imageNamed:@"对号框.png"] forState:UIControlStateNormal];
        self.ceshi.text=@"0";
        NSLog(@"0");
    }
    else if([string2 isEqualToString:@"1"])
    {
        _yonghuchoose = NO;
        [self.yonghu setImage:[UIImage imageNamed:@"对号.png"] forState:UIControlStateNormal];
        self.ceshi.text=@"1";
        NSLog(@"1");
    }
    else
    {
        _yonghuchoose = YES;
        [self.yonghu setImage:[UIImage imageNamed:@"对号框.png"] forState:UIControlStateNormal];
        self.ceshi.text=@"0";
    }

    [self.yonghu addTarget:self action:@selector(WarrantyOptions:) forControlEvents:UIControlEventTouchUpInside];
    [self.containerView addSubview:self.yonghu];
    UILabel *label14 = [[UILabel alloc]initWithFrame:CGRectMake(700, 333, 150, 30)];
    label14.text=@"是否协议客户";
    label14.textColor = [UIColor grayColor];
    [self.containerView addSubview:label14];
    

    self.baocunButton = [[UIButton alloc]initWithFrame:CGRectMake(820, 65, 80, 35)];
    [self.baocunButton setBackgroundImage:[UIImage imageNamed:@"ht05-1.png"] forState:UIControlStateNormal];
    [self.baocunButton setTitle:@"保 存" forState:UIControlStateNormal];
    [self.baocunButton setTintColor:[UIColor whiteColor]];
    self.baocunButton.titleLabel.font = [UIFont fontWithName:@"ArialMT" size:15];
    [self.baocunButton addTarget:self action:@selector(baocunButton:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.baocunButton];
    
}
-(void)WarrantyOptions:(id)sender
{
        if(_yonghuchoose == YES)
        {
        _yonghuchoose = NO;
        [self.yonghu  setImage:[UIImage imageNamed:@"对号.png"] forState:UIControlStateNormal];
        _ceshi.text=@"1";
        NSLog(@"1");
        }
        else if(_yonghuchoose==NO)
        {
        _yonghuchoose = YES;
        [self.yonghu setImage:[UIImage imageNamed:@"对号框.png"] forState:UIControlStateNormal];
        NSLog(@"0");
        _ceshi.text=@"0";
        }
    
}

-(void)baocunButton:(id)sender
{
    NSLog(@"%@",self.customerInsideDit);
    NSLog(@"%@",self.ceshi.text);
    //拿到要提交的数据
    self.customerInsideDit = [[NSMutableDictionary alloc]initWithCapacity:10];
    //客户编号
    [self.customerInsideDit setObject:self.keHuBianHao.text forKey:@"customerId"];
    //客户名称
    if(self.editNewfield2.text != nil)
    {
        [self.customerInsideDit setObject:self.editNewfield2.text forKey:@"customerName"];
    }
    //手机号
    if(self.editNewfield3.text == nil || [self.editNewfield3.text isEqualToString:@""])
    {
        self.editNewfield3.text = @"";
    }
    [self.customerInsideDit setObject:self.editNewfield3.text forKey:@"mobile"];
    //客户来源
    if([self.editNewbutton1.titleLabel.text isEqualToString:@"自然来店"])
    {
        [self.customerInsideDit setObject:@"A1" forKey:@"sourceId"];
    }
    if([self.editNewbutton1.titleLabel.text isEqualToString:@"保有增购/换购"])
    {
        [self.customerInsideDit setObject:@"A2" forKey:@"sourceId"];
    }
    if([self.editNewbutton1.titleLabel.text isEqualToString:@"情报提供"])
    {
        [self.customerInsideDit setObject:@"A3" forKey:@"sourceId"];
    }
    if([self.editNewbutton1.titleLabel.text isEqualToString:@"店外开发"])
    {
        [self.customerInsideDit setObject:@"A4" forKey:@"sourceId"];
    }
    if([self.editNewbutton1.titleLabel.text isEqualToString:@"保有推介"])
    {
        [self.customerInsideDit setObject:@"A5" forKey:@"sourceId"];
    }
    //客户性质
    if([self.editNewbutton2.titleLabel.text isEqualToString:@"政府机关"])
    {
        [self.customerInsideDit setObject:@"C1" forKey:@"natureId"];
    }
    if([self.editNewbutton2.titleLabel.text isEqualToString:@"企事业单位"])
    {
        [self.customerInsideDit setObject:@"C2" forKey:@"natureId"];
    }
    if([self.editNewbutton2.titleLabel.text isEqualToString:@"私人"])
    {
        [self.customerInsideDit setObject:@"C3" forKey:@"natureId"];
    }
    //联系人
    [self.customerInsideDit setObject:self.editNewfield4.text forKey:@"contactMan"];
    //联系电话
    if(self.editNewfield5.text == nil || [self.editNewfield5.text isEqualToString:@""])
    {
        self.editNewfield5.text = @"";
    }
    [self.customerInsideDit setObject:self.editNewfield5.text forKey:@"tel"];
    //所在地区
    [self serchPCD];
    //联系地址
    if(self.editNewfield6.text == nil || [self.editNewfield6.text isEqualToString:@""])
    {
        self.editNewfield6.text = @"";
    }
    [self.customerInsideDit setObject:self.editNewfield6.text forKey:@"address"];
    //邮编
    if(self.editNewfield7.text == nil || [self.editNewfield7.text isEqualToString:@""])
    {
        self.editNewfield7.text = @"";
    }
    [self.customerInsideDit setObject:self.editNewfield7.text forKey:@"zipcode"];
    //传真
    if(self.editNewfield8.text == nil || [self.editNewfield8.text isEqualToString:@""])
    {
        self.editNewfield8.text = @"";
    }
    [self.customerInsideDit setObject:self.editNewfield8.text forKey:@"fax"];
    //性别
    if([self.editNewbutton3.titleLabel.text isEqualToString:@"男"])
    {
        [self.customerInsideDit setObject:@"M" forKey:@"gender"];
    }
    if([self.editNewbutton3.titleLabel.text isEqualToString:@"女"])
    {
        [self.customerInsideDit setObject:@"F" forKey:@"gender"];
    }
    //出生日期
    if(self.editNewbutton4.titleLabel.text == nil || [self.editNewbutton4.titleLabel.text isEqualToString:@""])
    {
        self.editNewbutton4.titleLabel.text = @"";
    }
    [self.customerInsideDit setObject:self.editNewbutton4.titleLabel.text forKey:@"birthday"];
    //证件类型
    if(self.editNewbutton5.titleLabel.text == nil || [self.editNewbutton5.titleLabel.text isEqualToString:@""])
    {
        self.editNewbutton5.titleLabel.text = @"";
    }
    [self.customerInsideDit setObject:self.editNewbutton5.titleLabel.text forKey:@"certificateType"];
    //证件号码
    if(self.editNewfield9.text == nil || [self.editNewfield9.text isEqualToString:@""])
    {
        self.editNewfield9.text = @"";
    }
    [self.customerInsideDit setObject:self.editNewfield9.text forKey:@"certificate"];
    //职业
    if(self.editNewbutton6.titleLabel.text != nil)
    {
        NSMutableArray *professionArray = [NSMutableArray arrayWithArray:[self.dicTmp objectForKey:@"profession"]];
        NSMutableArray *keyArray = [[NSMutableArray alloc]init];
        NSMutableArray *valueArray = [[NSMutableArray alloc]init];
        for(int i = 0; i < [professionArray count];i++)
        {
            [valueArray addObject:[[professionArray objectAtIndex:i] objectForKey:@"value"]];
            [keyArray addObject:[[professionArray objectAtIndex:i] objectForKey:@"key"]];
        }
        NSString *professionText = [keyArray objectAtIndex:[valueArray indexOfObject:self.editNewbutton6.titleLabel.text]];
        [self.customerInsideDit setObject:professionText forKey:@"job"];
    }
    //兴趣爱好
//    NSLog(@"~~~<<<><><%@",self.editNewbutton7.titleLabel.text);
    if(self.editNewbutton7.titleLabel.text != nil)
    {
        NSMutableArray *hobbiesArray = [NSMutableArray arrayWithArray:[self.dicTmp objectForKey:@"hobby"]];
        NSMutableArray *hobbieskeyArray = [[NSMutableArray alloc]init];
        NSMutableArray *hobbiesvalueArray = [[NSMutableArray alloc]init];
        for(int i = 0; i < [hobbiesArray count];i++)
        {
            [hobbiesvalueArray addObject:[[hobbiesArray objectAtIndex:i] objectForKey:@"value"]];
            [hobbieskeyArray addObject:[[hobbiesArray objectAtIndex:i] objectForKey:@"key"]];
        }
        NSString *hobbiesText = [hobbieskeyArray objectAtIndex:[hobbiesvalueArray indexOfObject:self.editNewbutton7.titleLabel.text]];
        [self.customerInsideDit setObject:hobbiesText forKey:@"hobbies"];
    }
    //婚姻状况
    if([self.editNewbutton8.titleLabel.text isEqualToString:@"未婚"])
    {
        [self.customerInsideDit setObject:@"S" forKey:@"marital"];
    }
    if([self.editNewbutton8.titleLabel.text isEqualToString:@"已婚"])
    {
        [self.customerInsideDit setObject:@"M" forKey:@"marital"];
    }
    //生产厂家
    if([self.editNewbutton9.titleLabel.text rangeOfString:@" "].location)
    {
        NSMutableArray *carShopArray = [NSMutableArray arrayWithArray:[self.dicTmp objectForKey:@"car_shop"]];
        NSMutableArray *CarKeyArray = [[NSMutableArray alloc]init];
        NSMutableArray *CarValueArray = [[NSMutableArray alloc]init];
        for(int i = 0; i < [carShopArray count];i++)
        {
            [CarValueArray addObject:[[carShopArray objectAtIndex:i] objectForKey:@"value"]];
            [CarKeyArray addObject:[[carShopArray objectAtIndex:i] objectForKey:@"key"]];
        }
        NSString *carShopText = [CarKeyArray objectAtIndex:[CarValueArray indexOfObject:self.editNewbutton9.titleLabel.text]];
        [self.customerInsideDit setObject:carShopText forKey:@"originalfactory"];
        //车辆品牌
        NSMutableArray *brandArray = [NSMutableArray arrayWithArray:[[carShopArray objectAtIndex:[CarValueArray indexOfObject:self.editNewbutton9.titleLabel.text]] objectForKey:@"brand"]];
        NSMutableArray *brandKeyArray = [[NSMutableArray alloc]init];
        NSMutableArray *brandValueArray = [[NSMutableArray alloc]init];

        for(int i = 0; i < [brandArray count];i++)
        {
            [brandValueArray addObject:[[brandArray objectAtIndex:i] objectForKey:@"value"]];
            [brandKeyArray addObject:[[brandArray objectAtIndex:i] objectForKey:@"key"]];
        }
        //如果品牌neme的数组里有这个元素就取出它对应的id
        if([brandValueArray containsObject:self.editNewbutton10.titleLabel.text])
        {
            NSString *brandText = [brandKeyArray objectAtIndex:[brandValueArray indexOfObject:self.editNewbutton10.titleLabel.text]];
            [self.customerInsideDit setObject:brandText forKey:@"originalcar"];
        }
    }

    //备注
    if(self.noteTextView.text == nil || [self.noteTextView.text isEqualToString:@""])
    {
        self.noteTextView.text = @"";
    }
    [self.customerInsideDit setObject:self.noteTextView.text forKey:@"remark"];
    [self.customerInsideDit setObject:self.ceshi.text forKey:@"ispayclient"];
//    NSLog(@"%@",self.customerInsideDit);

        webService *web = [[webService alloc]init];
        web.methodName = UPDATEREPAIRCUSTOMER;

        [web commonPostSharedRequest:UPDATEREPAIRCUSTOMER psotDic:self.customerInsideDit];
}
-(void)updateRepairCustomer:(NSNotification*)notification
{
    NSMutableDictionary *theJson = [NSJSONSerialization JSONObjectWithData:(NSData *)notification.object options:NSJSONReadingMutableLeaves error:nil];
    if([[theJson valueForKey:@"error_code"] intValue])
    {
//        NSLog(@"*!*!*!*!*!%@",[theJson valueForKey:@"error_code"]);
        UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:[theJson valueForKey:@"error_msg"] message:nil delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
        [alertView show];
    }
    else
    {
        //拿到要显示的数据
        self.accordingDic = [[NSMutableDictionary alloc]initWithCapacity:10];
        //客户编号
        [self.accordingDic setObject:self.keHuBianHao.text forKey:@"customerId"];
        //客户名称
        if(self.editNewfield2.text != nil)
        {
            [self.accordingDic setObject:self.editNewfield2.text forKey:@"customerName"];
        }
        //手机号
        if(self.editNewfield3.text != nil)
        {
            [self.accordingDic setObject:self.editNewfield3.text forKey:@"mobile"];
        }
        //客户来源
        if(self.editNewbutton1.titleLabel.text == nil || [self.editNewbutton1.titleLabel.text isEqualToString:@""])
        {
            self.editNewbutton1.titleLabel.text = @"";
        }
        [self.accordingDic setObject:self.editNewbutton1.titleLabel.text forKey:@"sourceName"];
        //客户性质
        if(self.editNewbutton2.titleLabel.text == nil || [self.editNewbutton2.titleLabel.text isEqualToString:@""])
        {
            self.editNewbutton2.titleLabel.text = @"";
        }
        [self.accordingDic setObject:self.editNewbutton2.titleLabel.text forKey:@"natureName"];
        //联系人
        if(self.editNewfield4.text != nil)
        {
            [self.accordingDic setObject:self.editNewfield4.text forKey:@"contactMan"];
        }
        //联系电话
        if(self.editNewfield5.text != nil)
        {
            [self.accordingDic setObject:self.editNewfield5.text forKey:@"tel"];
        }
        //所在地区
        [self.accordingDic setObject:self.diQuSheng.titleLabel.text forKey:@"province"];
        [self.accordingDic setObject:self.diQuShi.titleLabel.text forKey:@"city"];
        [self.accordingDic setObject:self.diQuDiqu.titleLabel.text forKey:@"district"];
        //联系地址
        if(self.editNewfield6.text == nil || [self.editNewfield6.text isEqualToString:@""])
        {
            self.editNewfield6.text = @"";
        }
        [self.accordingDic setObject:self.editNewfield6.text forKey:@"address"];
        //邮编
        if(self.editNewfield7.text == nil || [self.editNewfield7.text isEqualToString:@""])
        {
            self.editNewfield7.text = @"";
        }
        [self.accordingDic setObject:self.editNewfield7.text forKey:@"zipcode"];
        //传真
        if(self.editNewfield8.text == nil || [self.editNewfield8.text isEqualToString:@""])
        {
            self.editNewfield8.text = @"";
        }
        [self.accordingDic setObject:self.editNewfield8.text forKey:@"fax"];
        //性别
        if(self.editNewbutton3.titleLabel.text != nil)
        {
            [self.accordingDic setObject:self.editNewbutton3.titleLabel.text forKey:@"gender"];
        }
        //出生日期
        if(self.editNewbutton4.titleLabel.text == nil || [self.editNewbutton4.titleLabel.text isEqualToString:@""])
        {
            self.editNewbutton4.titleLabel.text = @"";
        }
        [self.accordingDic setObject:self.editNewbutton4.titleLabel.text forKey:@"birthday"];
        //证件类型
        if(self.editNewbutton5.titleLabel.text == nil || [self.editNewbutton5.titleLabel.text isEqualToString:@""])
        {
            self.editNewbutton5.titleLabel.text = @"";
        }
        [self.accordingDic setObject:self.editNewbutton5.titleLabel.text forKey:@"certificateType"];
        //证件号码
        if(self.editNewfield9.text == nil || [self.editNewfield9.text isEqualToString:@""])
        {
            self.editNewfield9.text = @"";
        }
        [self.accordingDic setObject:self.editNewfield9.text forKey:@"certificate"];
        //职业
        if(self.editNewbutton6.titleLabel.text == nil || [self.editNewbutton6.titleLabel.text isEqualToString:@""])
        {
            self.editNewbutton6.titleLabel.text = @"";
        }
        [self.accordingDic setObject:self.editNewbutton6.titleLabel.text forKey:@"job"];
        //兴趣爱好
        if(self.editNewbutton7.titleLabel.text == nil || [self.editNewbutton7.titleLabel.text isEqualToString:@""])
        {
            self.editNewbutton7.titleLabel.text = @"";
        }
        [self.accordingDic setObject:self.editNewbutton7.titleLabel.text forKey:@"hobbies"];
        //婚姻状况
        if(self.editNewbutton8.titleLabel.text == nil || [self.editNewbutton8.titleLabel.text isEqualToString:@""])
        {
            self.editNewbutton8.titleLabel.text = @"";
        }
        [self.accordingDic setObject:self.editNewbutton8.titleLabel.text forKey:@"marital"];
        //生产厂家
        if(self.editNewbutton9.titleLabel.text == nil || [self.editNewbutton9.titleLabel.text isEqualToString:@""])
        {
            self.editNewbutton9.titleLabel.text = @"";
        }
        [self.accordingDic setObject:self.editNewbutton9.titleLabel.text forKey:@"originalfactory"];
        //车辆品牌
        if(self.editNewbutton10.titleLabel.text == nil || [self.editNewbutton10.titleLabel.text isEqualToString:@""])
        {
            self.editNewbutton10.titleLabel.text = @"";
        }
        [self.accordingDic setObject:self.editNewbutton10.titleLabel.text forKey:@"originalcar"];
        //备注
        if(self.noteTextView.text == nil || [self.noteTextView.text isEqualToString:@""])
        {
            self.noteTextView.text = @"";
        }
        [self.accordingDic setObject:self.noteTextView.text forKey:@"remark"];
        
//        NSLog(@"消息的字典：：：：：%@",self.accordingDic);
        //发送消息将数据传给详细页面
        NSNotification *notification = [NSNotification notificationWithName:@"accordingDic" object:self.accordingDic];
        [[NSNotificationCenter defaultCenter]postNotification:notification];
        
        if([self.douBiZhaoshaofei isEqualToString:@"赵少飞我操你姥姥"])
        {
            NSNotification *notification = [NSNotification notificationWithName:@"douBiZhaoShaoFei" object:self.accordingDic];
            [[NSNotificationCenter defaultCenter]postNotification:notification];
        }
        InformationViewController *viewcontroller=[self.navigationController.childViewControllers objectAtIndex:1];
        [self.navigationController popToViewController:viewcontroller animated:YES];

       // [self.navigationController popViewControllerAnimated:YES];
        
        [self removeNotification];
    }
}
-(void)content
{
    UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [backButton setImage:[UIImage imageNamed:@"返回.png"] forState:UIControlStateNormal];
    [backButton setFrame:CGRectMake(70, 35, 45, 60)];
    [backButton addTarget:self action:@selector(NewCustomerBack:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:backButton];
    
    UILabel *jiedai = [[UILabel alloc]initWithFrame:CGRectMake(160, 53, 200, 40)];
    jiedai.text = @"客户资料编辑";
    jiedai.backgroundColor = [UIColor clearColor];
    jiedai.textColor = [UIColor grayColor];
    jiedai.font = [UIFont systemFontOfSize:28];
    [self.view addSubview:jiedai];
    
    UIImageView *image = [[UIImageView alloc]initWithFrame:CGRectMake(20, 110, 1000, 11)];
    image.image = [UIImage imageNamed:@"渐变分割线.png"];
    [self.view addSubview:image];
    
    NSMutableArray *labelMutabelArray = [[NSMutableArray alloc]initWithObjects:@"客户编号:",@"客户名称:",@"手  机  号:",@"客户来源:",@"客户性质:",@"联  系  人:",@"联系电话:",@"所在地区:",@"备       注:", nil];
    for(int i = 0; i < 9;i++)
    {
        UILabel *titlelabel = [[UILabel alloc]initWithFrame:CGRectMake(15, (65+i*45), 100, 25)];
        [titlelabel setBackgroundColor:[UIColor clearColor]];
        titlelabel.text = [labelMutabelArray objectAtIndex:i];
        titlelabel.textColor = [UIColor grayColor];
        titlelabel.font = [UIFont fontWithName:@"ArialMT" size:16];
        //[titlelabel setTextAlignment:NSTextAlignmentCenter];
        [self.containerView addSubview:titlelabel];
    }
    NSMutableArray *labelMutabelArray2 = [[NSMutableArray alloc]initWithObjects:@"联系地址:",@"邮       编:",@"传       真:",@"性       别:",@"出生日期:",@"证件类型:",@"证件号码:", nil];
    for(int i = 0; i < 7;i++)
    {
        UILabel *titlelabel2 = [[UILabel alloc]initWithFrame:CGRectMake(300, (65+i*45), 95, 25)];
        [titlelabel2 setBackgroundColor:[UIColor clearColor]];
        titlelabel2.text = [labelMutabelArray2 objectAtIndex:i];
        titlelabel2.textColor = [UIColor grayColor];
        titlelabel2.font = [UIFont fontWithName:@"ArialMT" size:16];
        [self.containerView addSubview:titlelabel2];
    }
    NSMutableArray *labelMutabelArray3 = [[NSMutableArray alloc]initWithObjects:@"职       业:",@"兴趣爱好:",@"婚姻状况:",@"生产厂家:",@"车辆品牌:", nil];
    for(int i = 0; i < 5;i++)
    {
        UILabel *titlelabel3 = [[UILabel alloc]initWithFrame:CGRectMake(580, (115+i*45), 95, 25)];
        [titlelabel3 setBackgroundColor:[UIColor clearColor]];
        titlelabel3.text = [labelMutabelArray3 objectAtIndex:i];
        titlelabel3.textColor = [UIColor grayColor];
        titlelabel3.font = [UIFont fontWithName:@"ArialMT" size:16];
        [self.containerView addSubview:titlelabel3];
    }
    for(int i = 0; i < 7;i++)
    {
        UIImageView *xingxingimage = [[UIImageView alloc]initWithFrame:CGRectMake(5, (115+i*45), 10, 10)];
        [xingxingimage setImage:[UIImage imageNamed:@"xingxing.png"]];
        [self.containerView addSubview:xingxingimage];
    }
}
-(void)NewCustomerBack:(id)sender
{
    [self.navigationController popViewControllerAnimated:YES];
    [self removeNotification];
}
//********** 客户来源
-(void)editNewbutton1:(id)sender
{
    if (!contentCon) {
        contentCon=[[popContentViewController alloc] initWithNibName:@"popContentViewController" bundle:nil];
    }
    contentCon.delegate = self;
    contentCon.btnSender=sender;
    self.popCon = [[UIPopoverController alloc] initWithContentViewController:contentCon];
    [DDPopoverBackgroundView setTintColor:[UIColor colorWithRed:234 green:248 blue:242 alpha:0.9]];
    [DDPopoverBackgroundView setArrowBase:30.0];//箭头
    [DDPopoverBackgroundView setArrowHeight:15.0];
    [DDPopoverBackgroundView setContentInset:1.0];
    [self.popCon setPopoverBackgroundViewClass:[DDPopoverBackgroundView class]];
    [self.popCon setPopoverContentSize:CGSizeMake(self.editNewbutton7.frame.size.width, 200)];
    [self.popCon presentPopoverFromRect:CGRectMake(20, 10, 120, 20) inView:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
    
    NSMutableArray *carTypeArray=[[NSMutableArray alloc] init];
    [carTypeArray addObject:@"自然来店"];
    [carTypeArray addObject:@"保有增购/换购"];
    [carTypeArray addObject:@"情报提供"];
    [carTypeArray addObject:@"店外开发"];
    [carTypeArray addObject:@"保有推介"];
    contentCon.list = carTypeArray;
    [contentCon.myTableView reloadData];
}
//********** 客户性质
-(void)editNewbutton2:(id)sender
{
    if (!contentCon) {
        contentCon=[[popContentViewController alloc] initWithNibName:@"popContentViewController" bundle:nil];
    }
    contentCon.delegate = self;
    contentCon.btnSender=sender;
    self.popCon = [[UIPopoverController alloc] initWithContentViewController:contentCon];
    [DDPopoverBackgroundView setTintColor:[UIColor colorWithRed:234 green:248 blue:242 alpha:0.9]];
    [DDPopoverBackgroundView setArrowBase:30.0];//箭头
    [DDPopoverBackgroundView setArrowHeight:15.0];
    [DDPopoverBackgroundView setContentInset:1.0];
    [self.popCon setPopoverBackgroundViewClass:[DDPopoverBackgroundView class]];
    [self.popCon setPopoverContentSize:CGSizeMake(self.editNewbutton2.frame.size.width, 120)];
    
    NSMutableArray *carTypeArray=[[NSMutableArray alloc]initWithCapacity:10];
    [carTypeArray addObject:@"政府机关"];
    [carTypeArray addObject:@"企事业单位"];
    [carTypeArray addObject:@"私人"];
    contentCon.list = carTypeArray;
    
    [self.popCon presentPopoverFromRect:CGRectMake(20, 10, 120, 20) inView:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
    [contentCon.myTableView reloadData];
}
//********** 性别
-(void)editNewbutton3:(id)sender
{
    if (!contentCon) {
        contentCon=[[popContentViewController alloc] initWithNibName:@"popContentViewController" bundle:nil];
    }
    contentCon.delegate = self;
    contentCon.btnSender=sender;
    self.popCon = [[UIPopoverController alloc] initWithContentViewController:contentCon];
    [DDPopoverBackgroundView setTintColor:[UIColor colorWithRed:234 green:248 blue:242 alpha:0.9]];
    [DDPopoverBackgroundView setArrowBase:30.0];//箭头
    [DDPopoverBackgroundView setArrowHeight:15.0];
    [DDPopoverBackgroundView setContentInset:1.0];
    [self.popCon setPopoverBackgroundViewClass:[DDPopoverBackgroundView class]];
    [self.popCon setPopoverContentSize:CGSizeMake(self.editNewbutton7.frame.size.width, 80)];
    [self.popCon presentPopoverFromRect:CGRectMake(20, 10, 120, 20) inView:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
    
    NSMutableArray *carTypeArray=[[NSMutableArray alloc] init];
    [carTypeArray addObject:@"女"];
    [carTypeArray addObject:@"男"];
    
    contentCon.list = carTypeArray;
    [contentCon.myTableView reloadData];
}
//********** 出生日期
-(void)editNewbutton4:(id)sender
{
    self.datePicker = [[UIDatePicker alloc]initWithFrame:CGRectMake(0, 0, 280, 160)];
    self.datePicker.locale = [[NSLocale alloc] initWithLocaleIdentifier:NSLocalizedString(@"Chinese", @"")];
    self.datePicker.datePickerMode = UIDatePickerModeDate;
    
    [self.datePicker addTarget:self action:@selector(dateChanged:) forControlEvents:UIControlEventValueChanged];
    //
    panleCon = [[UIViewController alloc] init];
    [panleCon.view addSubview:self.datePicker];
    self.popCon = [[UIPopoverController alloc] initWithContentViewController:panleCon];
    self.popCon.popoverContentSize = CGSizeMake(280.0f, 160.0f);
    
    [self.popCon presentPopoverFromRect:CGRectMake(70, 0, 5, 30) inView:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
}
-(void)dateChanged:(id)sender
{
    UIDatePicker *contro = (UIDatePicker*)sender;
    NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
    [formatter setDateFormat:@"yyyy-MM-dd"];
    NSString *str = [formatter stringFromDate:contro.date];
    [self.editNewbutton4 setTitle:str forState:UIControlStateNormal];
}
//********** 证件类型
-(void)editNewbutton5:(id)sender
{
    if (!contentCon) {
        contentCon=[[popContentViewController alloc] initWithNibName:@"popContentViewController" bundle:nil];
    }
    contentCon.delegate = self;
    contentCon.btnSender=sender;
    self.popCon = [[UIPopoverController alloc] initWithContentViewController:contentCon];
    [DDPopoverBackgroundView setTintColor:[UIColor colorWithRed:234 green:248 blue:242 alpha:0.9]];
    [DDPopoverBackgroundView setArrowBase:30.0];//箭头
    [DDPopoverBackgroundView setArrowHeight:15.0];
    [DDPopoverBackgroundView setContentInset:1.0];
    [self.popCon setPopoverBackgroundViewClass:[DDPopoverBackgroundView class]];
    [self.popCon setPopoverContentSize:CGSizeMake(self.editNewbutton7.frame.size.width, 160)];
    [self.popCon presentPopoverFromRect:CGRectMake(20, 10, 120, 20) inView:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
    
    NSMutableArray *carTypeArray=[[NSMutableArray alloc] init];
    [carTypeArray addObject:@"身份证"];
    [carTypeArray addObject:@"护照"];
    [carTypeArray addObject:@"军官证"];
    [carTypeArray addObject:@"其他证件"];

    contentCon.list = carTypeArray;
    [contentCon.myTableView reloadData];
}
//********** 职业
-(void)editNewbutton6:(id)sender
{
    if (!contentCon) {
        contentCon=[[popContentViewController alloc] initWithNibName:@"popContentViewController" bundle:nil];
    }
    
    contentCon.delegate = self;
    contentCon.btnSender=sender;
    self.popCon = [[UIPopoverController alloc] initWithContentViewController:contentCon];
    [DDPopoverBackgroundView setTintColor:[UIColor colorWithRed:234 green:248 blue:242 alpha:0.9]];
    [DDPopoverBackgroundView setArrowBase:30.0];//箭头
    [DDPopoverBackgroundView setArrowHeight:15.0];
    [DDPopoverBackgroundView setContentInset:1.0];
    [self.popCon setPopoverBackgroundViewClass:[DDPopoverBackgroundView class]];
    [self.popCon setPopoverContentSize:CGSizeMake(self.editNewbutton7.frame.size.width, 280)];
    [self.popCon presentPopoverFromRect:CGRectMake(20, 10, 120, 20) inView:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
    NSMutableArray *profession = [[NSMutableArray alloc]init];
    self.professionIdArray = [self.dicTmp objectForKey:@"profession"];
    for(int i = 0;i < [[self.dicTmp objectForKey:@"profession"]count];i++)
    {
        [profession addObject:[[[self.dicTmp objectForKey:@"profession"] objectAtIndex:i]objectForKey:@"value"]];
    }
    contentCon.list = profession;
    [contentCon.myTableView reloadData];
}
//********** 兴趣爱好
-(void)editNewbutton7:(id)sender
{
    if (!contentCon) {
        contentCon=[[popContentViewController alloc] initWithNibName:@"popContentViewController" bundle:nil];
    }

    contentCon.delegate = self;
    contentCon.btnSender=sender;
    self.popCon = [[UIPopoverController alloc] initWithContentViewController:contentCon];
    [DDPopoverBackgroundView setTintColor:[UIColor colorWithRed:234 green:248 blue:242 alpha:0.9]];
    [DDPopoverBackgroundView setArrowBase:30.0];//箭头
    [DDPopoverBackgroundView setArrowHeight:15.0];
    [DDPopoverBackgroundView setContentInset:1.0];
    [self.popCon setPopoverBackgroundViewClass:[DDPopoverBackgroundView class]];
    [self.popCon setPopoverContentSize:CGSizeMake(self.editNewbutton7.frame.size.width, 280)];
    [self.popCon presentPopoverFromRect:CGRectMake(20, 10, 120, 20) inView:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
    
    NSMutableArray *hobby = [[NSMutableArray alloc]init];
    self.hobbyIdArray = [self.dicTmp objectForKey:@"hobby"];
    for(int i = 0;i < [[self.dicTmp objectForKey:@"hobby"]count];i++)
    {
        [hobby addObject:[[[self.dicTmp objectForKey:@"hobby"] objectAtIndex:i]objectForKey:@"value"]];
    }
    contentCon.list = hobby;
    [contentCon.myTableView reloadData];
}
//弹出回调方法
-(void)selectDelegate:(NSInteger)row btn:(UIButton *)btn
{
        NSMutableArray *xingZhiArray = [[NSMutableArray alloc]initWithObjects:@"C1",@"C2",@"C3", nil];//客户性质
        NSMutableArray *xingBieArray = [[NSMutableArray alloc]initWithObjects:@"F",@"M" ,nil];//性别
        NSMutableArray *hunYinArray = [[NSMutableArray alloc]initWithObjects:@"S",@"M", nil];//婚姻状况
        if(btn == self.editNewbutton2)
        {
            self.xingZhiId = [xingZhiArray objectAtIndex:row];
        }
        else if(btn == self.editNewbutton3)
        {
            self.xingBieId = [xingBieArray objectAtIndex:row];
        }
        else if(btn == self.editNewbutton8)
        {
            self.hunYinId = [hunYinArray objectAtIndex:row];
        }
    else if(btn == self.editNewbutton6)//职业
    {
        self.professionId = [[self.professionIdArray objectAtIndex:row]objectForKey:@"key"];
    }
    else if(btn == self.editNewbutton7)//兴趣爱好
    {
        self.hobbyId = [[self.hobbyIdArray objectAtIndex:row]objectForKey:@"key"];
    }
    else if(btn == self.editNewbutton9)//生产厂家
    {
        self.carShopId = [[self.carShopArray objectAtIndex:row]objectForKey:@"key"];
        self.carShopNumber = [NSString stringWithFormat:@"%d",row];
        [self.editNewbutton10 setTitle:[[[[[self.dicTmp objectForKey:@"car_shop"] objectAtIndex:row] objectForKey:@"brand"] objectAtIndex:0] objectForKey:@"value"] forState:UIControlStateNormal];
    }
    else if(btn == self.diQuSheng)//省
    {
        self.provinceId = [[self.provinceArray objectAtIndex:row]objectForKey:@"area"];
        self.provinceNumber = [NSString stringWithFormat:@"%d",row];
        
        [self.diQuShi setTitle:[[[[[self.dicTmp objectForKey:@"area"]objectAtIndex:row]objectForKey:@"subArea"]objectAtIndex:0]objectForKey:@"value"] forState:UIControlStateNormal];
        
        [self.diQuDiqu setTitle:[[[[[[[self.dicTmp objectForKey:@"area"]objectAtIndex:row]objectForKey:@"subArea"]objectAtIndex:0]objectForKey:@"subArea"]objectAtIndex:0]objectForKey:@"value"] forState:UIControlStateNormal];
    }
    else if(btn == self.diQuShi)//市
    {
        self.cityId = [[self.cityArray objectAtIndex:row]objectForKey:@"subArea"];
        self.cityNumber = [NSString stringWithFormat:@"%d",row];
    }
//        else
//        {
//            if(btn == self.editNewbutton2)
//            {
//                self.xingZhiId = @"< 空 >";
//            }
//            else if(btn == self.editNewbutton3)
//            {
//                self.xingBieId = @"< 空 >";
//            }
//            else if(btn == self.editNewbutton8)
//            {
//                self.hunYinId = @"< 空 >";
//            }
//        }
    
    [self.popCon dismissPopoverAnimated:YES];
    self.popCon = nil;
}

//********** 婚姻状况
-(void)editNewbutton8:(id)sender
{
    if (!contentCon) {
        contentCon=[[popContentViewController alloc] initWithNibName:@"popContentViewController" bundle:nil];
    }
    contentCon.delegate = self;
    contentCon.btnSender=sender;
    self.popCon = [[UIPopoverController alloc] initWithContentViewController:contentCon];
    [DDPopoverBackgroundView setTintColor:[UIColor colorWithRed:234 green:248 blue:242 alpha:0.9]];
    [DDPopoverBackgroundView setArrowBase:30.0];//箭头
    [DDPopoverBackgroundView setArrowHeight:15.0];
    [DDPopoverBackgroundView setContentInset:1.0];
    [self.popCon setPopoverBackgroundViewClass:[DDPopoverBackgroundView class]];
    [self.popCon setPopoverContentSize:CGSizeMake(self.editNewbutton8.frame.size.width, 80)];
    [self.popCon presentPopoverFromRect:CGRectMake(20, 10, 120, 20) inView:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
    
    NSMutableArray *carTypeArray=[[NSMutableArray alloc] init];
    [carTypeArray addObject:@"未婚"];
    [carTypeArray addObject:@"已婚"];
    
    contentCon.list = carTypeArray;
    [contentCon.myTableView reloadData];
}
//********** 生产厂家
-(void)editNewbutton9:(id)sender
{
    self.editNewbutton10.titleLabel.text = @"";
    if (!contentCon) {
        contentCon=[[popContentViewController alloc] initWithNibName:@"popContentViewController" bundle:nil];
    }
    
    contentCon.delegate = self;
    contentCon.btnSender=sender;
    self.popCon = [[UIPopoverController alloc] initWithContentViewController:contentCon];
    [DDPopoverBackgroundView setTintColor:[UIColor colorWithRed:234 green:248 blue:242 alpha:0.9]];
    [DDPopoverBackgroundView setArrowBase:30.0];//箭头
    [DDPopoverBackgroundView setArrowHeight:15.0];
    [DDPopoverBackgroundView setContentInset:1.0];
    [self.popCon setPopoverBackgroundViewClass:[DDPopoverBackgroundView class]];
    [self.popCon setPopoverContentSize:CGSizeMake(self.editNewbutton9.frame.size.width, 280)];
    [self.popCon presentPopoverFromRect:CGRectMake(20, 10, 120, 20) inView:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
    
    NSMutableArray *hobby = [[NSMutableArray alloc]init];
    self.carShopArray = [self.dicTmp objectForKey:@"car_shop"];
    for(int i = 0;i < [[self.dicTmp objectForKey:@"car_shop"]count];i++)
    {
        [hobby addObject:[[[self.dicTmp objectForKey:@"car_shop"] objectAtIndex:i]objectForKey:@"value"]];
    }
    contentCon.list = hobby;
    [contentCon.myTableView reloadData];
}
//********** 车辆品牌
-(void)editNewbutton10:(id)sender
{
    if (!contentCon) {
        contentCon=[[popContentViewController alloc] initWithNibName:@"popContentViewController" bundle:nil];
    }
    
    contentCon.delegate = self;
    contentCon.btnSender=sender;
    self.popCon = [[UIPopoverController alloc] initWithContentViewController:contentCon];
    [DDPopoverBackgroundView setTintColor:[UIColor colorWithRed:234 green:248 blue:242 alpha:0.9]];
    [DDPopoverBackgroundView setArrowBase:30.0];//箭头
    [DDPopoverBackgroundView setArrowHeight:15.0];
    [DDPopoverBackgroundView setContentInset:1.0];
    [self.popCon setPopoverBackgroundViewClass:[DDPopoverBackgroundView class]];
    [self.popCon setPopoverContentSize:CGSizeMake(self.editNewbutton10.frame.size.width, 280)];
    [self.popCon presentPopoverFromRect:CGRectMake(20, 10, 120, 20) inView:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
    
    int index = [self.carShopNumber intValue];
    NSMutableArray *brand = [[NSMutableArray alloc]init];
    self.carShopArray = [[[self.dicTmp objectForKey:@"car_shop"] objectAtIndex:index] objectForKey:@"brand"];
    for(int i = 0;i < [[[[self.dicTmp objectForKey:@"car_shop"] objectAtIndex:index] objectForKey:@"brand"]count];i++)
    {
        [brand addObject:[[[[[self.dicTmp objectForKey:@"car_shop"] objectAtIndex:index] objectForKey:@"brand"]objectAtIndex:i] objectForKey:@"value"]];
    }
    contentCon.list = brand;
    [contentCon.myTableView reloadData];
}
- (void) niDropDownDelegateMethod: (NIDropDown *) sender
{
    dropDown = nil;
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
#pragma mark - 省市地区选择按钮的回调
-(void)diQuSheng:(id)sender
{
    self.diQuShi.titleLabel.text = nil;
    self.diQuDiqu.titleLabel.text = nil;
    
    if (!contentCon) {
        contentCon=[[popContentViewController alloc] initWithNibName:@"popContentViewController" bundle:nil];
    }
    
    contentCon.delegate = self;
    contentCon.btnSender=sender;
    self.popCon = [[UIPopoverController alloc] initWithContentViewController:contentCon];
    [DDPopoverBackgroundView setTintColor:[UIColor colorWithRed:234 green:248 blue:242 alpha:0.9]];
    [DDPopoverBackgroundView setArrowBase:30.0];//箭头
    [DDPopoverBackgroundView setArrowHeight:15.0];
    [DDPopoverBackgroundView setContentInset:1.0];
    [self.popCon setPopoverBackgroundViewClass:[DDPopoverBackgroundView class]];
    [self.popCon setPopoverContentSize:CGSizeMake(self.diQuSheng.frame.size.width, 280)];
    [self.popCon presentPopoverFromRect:CGRectMake(20, 10, 110, 20) inView:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];

    NSMutableArray *container = [[NSMutableArray alloc]init];
    self.provinceArray = [NSMutableArray arrayWithArray:[self.dicTmp objectForKey:@"area"]];
    for(int i = 0; i < [self.provinceArray count]; i++)
    {
       [container addObject:[[self.provinceArray objectAtIndex:i]objectForKey:@"value"]];
    }
    contentCon.list = container;
    [contentCon.myTableView reloadData];
}
-(void)diQuShi:(id)sender
{
    self.diQuDiqu.titleLabel.text = nil;
    if (!contentCon) {
        contentCon=[[popContentViewController alloc] initWithNibName:@"popContentViewController" bundle:nil];
    }
    
    contentCon.delegate = self;
    contentCon.btnSender=sender;
    self.popCon = [[UIPopoverController alloc] initWithContentViewController:contentCon];
    [DDPopoverBackgroundView setTintColor:[UIColor colorWithRed:234 green:248 blue:242 alpha:0.9]];
    [DDPopoverBackgroundView setArrowBase:30.0];//箭头
    [DDPopoverBackgroundView setArrowHeight:15.0];
    [DDPopoverBackgroundView setContentInset:1.0];
    [self.popCon setPopoverBackgroundViewClass:[DDPopoverBackgroundView class]];
    [self.popCon setPopoverContentSize:CGSizeMake(self.diQuSheng.frame.size.width, 280)];
    [self.popCon presentPopoverFromRect:CGRectMake(20, 10, 110, 20) inView:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
    
    int index = [self.provinceNumber intValue];
    NSMutableArray *container = [[NSMutableArray alloc]init];
    self.cityArray = [NSMutableArray arrayWithArray:[[[self.dicTmp objectForKey:@"area"] objectAtIndex:index] objectForKey:@"subArea"]];
    for(int i = 0; i < [self.cityArray count]; i++)
    {
        [container addObject:[[self.cityArray objectAtIndex:i]objectForKey:@"value"]];
    }
    contentCon.list = container;
    [contentCon.myTableView reloadData];
}
-(void)diQuDiqu:(id)sender
{
    if (!contentCon) {
        contentCon=[[popContentViewController alloc] initWithNibName:@"popContentViewController" bundle:nil];
    }
    
    contentCon.delegate = self;
    contentCon.btnSender=sender;
    self.popCon = [[UIPopoverController alloc] initWithContentViewController:contentCon];
    [DDPopoverBackgroundView setTintColor:[UIColor colorWithRed:234 green:248 blue:242 alpha:0.9]];
    [DDPopoverBackgroundView setArrowBase:30.0];//箭头
    [DDPopoverBackgroundView setArrowHeight:15.0];
    [DDPopoverBackgroundView setContentInset:1.0];
    [self.popCon setPopoverBackgroundViewClass:[DDPopoverBackgroundView class]];
    [self.popCon setPopoverContentSize:CGSizeMake(self.diQuSheng.frame.size.width, 280)];
    [self.popCon presentPopoverFromRect:CGRectMake(20, 10, 110, 20) inView:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
    
    int index = [self.cityNumber intValue];
    NSMutableArray *container = [[NSMutableArray alloc]init];
    self.countyArray = [NSMutableArray arrayWithArray:[[self.cityArray objectAtIndex:index] objectForKey:@"subArea"]];
    for(int i = 0; i < [self.countyArray count]; i++)
    {
        [container addObject:[[self.countyArray objectAtIndex:i]objectForKey:@"value"]];
    }
    contentCon.list = container;
    [contentCon.myTableView reloadData];
}
-(void)textViewDidBeginEditing:(UITextView *)textView
{
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:0.4];
    [self.view setFrame:CGRectMake(0, 0-200, 1024, 768)];
    [UIView commitAnimations];
}
-(void)textFieldDidBeginEditing:(UITextField *)textField     //弹出键盘的时候上提
{
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:0.4];
    [self.view setFrame:CGRectMake(0, 0-100, 1024, 768)];
    [UIView commitAnimations];
}
- (void)keyboardHide:(NSNotification *)notif   //键盘即将消失的时候点done归为view
{
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:0.3];
    [self.view setFrame:CGRectMake(0, 0, 1024, 768)];
    [UIView commitAnimations];
}
//通过名字查找省市地的Id
-(void)serchPCD
{
//    NSLog(@"他妈的省：%@",self.diQuSheng.titleLabel.text);
//    NSLog(@"他妈的市：%@",self.diQuShi.titleLabel.text);
//    NSLog(@"他妈的区：%@",self.diQuDiqu.titleLabel.text);
    //查找省
    NSMutableArray *container = [[NSMutableArray alloc]init];
    NSMutableArray *nameS = [[NSMutableArray alloc]init];
    NSMutableArray *provinceArray = [NSMutableArray arrayWithArray:[self.dicTmp objectForKey:@"area"]];
    for(int i = 0; i < [provinceArray count]; i++)
    {
        [container addObject:[[provinceArray objectAtIndex:i]objectForKey:@"key"]];
        [nameS addObject:[[provinceArray objectAtIndex:i] objectForKey:@"value"]];
    }
    NSString *str = [container objectAtIndex:[nameS indexOfObject:self.diQuSheng.titleLabel.text]];
    //查找市
    NSMutableArray *container2 = [[NSMutableArray alloc]init];
    NSMutableArray *nameY = [[NSMutableArray alloc]init];
    NSMutableArray *cityArray = [NSMutableArray arrayWithArray:[[provinceArray objectAtIndex:[nameS indexOfObject:self.diQuSheng.titleLabel.text]] objectForKey:@"subArea"]];
    for(int i = 0; i < [cityArray count]; i++)
    {
        [container2 addObject:[[cityArray objectAtIndex:i]objectForKey:@"key"]];
        [nameY addObject:[[cityArray objectAtIndex:i] objectForKey:@"value"]];
    }
    NSString *str2 = [container2 objectAtIndex:[nameY indexOfObject:self.diQuShi.titleLabel.text]];
    //查找地区
    NSMutableArray *container3 = [[NSMutableArray alloc]init];
    NSMutableArray *nameD = [[NSMutableArray alloc]init];
    NSMutableArray *countyArray = [NSMutableArray arrayWithArray:[[cityArray objectAtIndex:[nameY indexOfObject:self.diQuShi.titleLabel.text]] objectForKey:@"subArea"]];
    for(int i = 0; i < [countyArray count]; i++)
    {
        [container3 addObject:[[countyArray objectAtIndex:i]objectForKey:@"key"]];
        [nameD addObject:[[countyArray objectAtIndex:i] objectForKey:@"value"]];
    }
    NSString *str3 = [container3 objectAtIndex:[nameD indexOfObject:self.diQuDiqu.titleLabel.text]];
    
    NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithDictionary:self.customerInsideDit];
    [dict setObject:str forKey:@"province"];
    [dict setObject:str2 forKey:@"city"];
    [dict setObject:str3 forKey:@"district"];
    self.customerInsideDit = dict;
    
//    NSLog(@"他妈的省：%@",[self.customerInsideDit objectForKey:@"province"]);
//    NSLog(@"他妈的市：%@",[self.customerInsideDit objectForKey:@"city"]);
//    NSLog(@"他妈的区：%@",[self.customerInsideDit objectForKey:@"district"]);
}
-(void)addNotification
{
    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(updateRepairCustomer:) name:UPDATEREPAIRCUSTOMER object:nil];//车主信息修改 
}
-(void)removeNotification
{
    [[NSNotificationCenter defaultCenter]removeObserver:self];
}
@end
